<template>
  <el-button type="primary"
             @click="updateUrlDic">更新字典</el-button><br /><br />
  <avue-form ref="form"
             :option="option"
             v-model="form"></avue-form>
</template>
<script>
export default {
  data () {
    return {
      form: {},
      option: {
        column: [{
          label: '字典',
          span: 24,
          type: 'checkbox',
          prop: 'checkbox',
          dicUrl: 'https://cli.avuejs.com/api/area/getProvince',
          props: {
            label: 'name',
            value: 'code'
          }
        }]
      }
    }
  },
  methods: {
    updateUrlDic () {
      var form = this.$refs.form
      this.$message.success('先设置本地字典1s后请求url')
      form.updateDic('checkbox', [{
        name: '字典1',
        code: 1
      }, {
        name: '字典0',
        code: 2
      }]);
      setTimeout(() => {
        form.updateDic('checkbox');
      }, 1000)
    },
  }
}
</script>